/*
Java source file
Copyright: Umschalt.com 2012
*/
package com.david.documentation.web.view.pages;

import com.david.documentation.service.category.CategoryService;
import com.david.documentation.service.doku.DokuService;
import com.david.documentation.web.BasePage;
import com.david.documentation.web.view.dataProvider.CategoryDataProvider;
import com.david.documentation.web.view.panels.CategoryPanel;
import com.david.documentation.web.view.panels.SearchResultPanel;
import org.apache.wicket.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;

public class CategoryPage extends BasePage{

	@SpringBean
	private CategoryService categoryService;

	@SpringBean
	private DokuService dokuService;

	public CategoryPage(){
		this(null);
	}

	public CategoryPage(PageParameters parameters){

		String category = "";
		if (parameters != null && parameters.containsKey("category")){
			category = parameters.get("category").toString();
			add(new SearchResultPanel("panel",new CategoryDataProvider(category,dokuService),category));
		} else {
			add(new CategoryPanel("panel",categoryService));
		}
	}


}
